package com.example.crud.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.crud.mapper.GradeMapper;
import com.example.crud.model.Grade;
import com.example.crud.service.GradeService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * Created with IntelliJ IDEA.
 * ClassName: GradeServiceImpl
 * Package: com.example.crud.service.impl
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-01-15
 * Time: 20:24
 */
@Service
public class GradeServiceImpl extends ServiceImpl<GradeMapper, Grade>
        implements GradeService {

    @Override
    public IPage<Grade> getGradeByOpr(Page<Grade> pageParam, String gradeName) {
        //条件构造器 设置条件查询
        QueryWrapper<Grade> queryWrapper = new QueryWrapper<>();
        if (!StringUtils.isEmpty(gradeName)){
            queryWrapper.like("name",gradeName);
        }

        queryWrapper.orderByDesc("id");
        return null;
    }
}
